package com.yyh.ribbon.service;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

/**
 * Author : 尤毅鹤
 * Date: 2019/12/17 13:19
 * Description: <描述>
 */
@Service
public class RibbonService {
    @Autowired
    RestTemplate restTemplate;
    @HystrixCommand(fallbackMethod = "hiError")
    public String userTest() {
       return restTemplate.getForObject("http://spring-cloud-web-user/user/login",String.class);
    }

    public  String hiError(){
        return "网络连接失败";
    }
}
